package Chapter_10;

import java.io.*;

public class   Test01 {
    public static void main(String[] args) throws IOException{
            //字节流的方式
//            FileInputStream inputStream = new FileInputStream("C:\\Users\\30539\\Desktop\\text2.txt");
//            FileOutputStream outputStream = new FileOutputStream("C:\\Users\\30539\\Desktop\\text.txt");
//            byte[] bytes = new byte[1024];
//            int len;
//            while((len = inputStream.read(bytes))!=-1){
//                outputStream.write(bytes,0,len);
//            }
//            inputStream.close();
//            outputStream.close();
            //通过字符流的方式
        BufferedReader bufferedReader = new BufferedReader(new FileReader("C:\\Users\\30539\\Desktop\\text2.txt"));
        BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter("C:\\Users\\30539\\Desktop\\text.txt"));
        String len;
        while((len = bufferedReader.readLine())!=null){
            bufferedWriter.write(len);
            bufferedWriter.newLine();
            }
        bufferedWriter.close();
        bufferedReader.close();
        }
    }

